<!DOCTYPE html>
<html>
<head>
    <title><%=title%></title>
    <script src="/js/jquery.min.js"></script>
</head>
    <script>
        function submitform(){
            var articleTitle = $("#articleTitle").val();
            var content = $("#content").val();
            if (articleTitle.length == 0) {
                $("#alert1").show() ;
                $("#alert").html('请输入文章标题') ;
                return false;
            }
            if (content.length == 0) {
                $("#alert1").show() ;
                $("#alert").html('请输入文章内容') ;
                return false;
            }
           $.ajax({
                type: "GET",
                url: "/reportArticle/",
                data: "at=" + articleTitle + "&con=" + content + "&time="  + new Date(),
                success: function (result)  {
                    if (result == "1") {
                        window.location.href = "/reportSucc/"
                        return false;
                    }
                    else {
                        $("#alert1").show() ;
                        $("#alert").html("文章发表失败，请重新输入") ;
                        return false;

                    }
                }
            });
        }
    </script>
<body>
<div class="container-fluid" style="display:none" id="alert1">
     <div class="row-fluid">
        <div class="span12">
            <div class="alert alert-error">

                <h4>
                    提示!
                </h4> <strong>警告!</strong><div id="alert" ></div>
            </div>
        </div>
    </div>
</div>
        <label>发表新文章</label><br/><br/>
        文章标题：
        <input type="text" name="articleTitle" id="articleTitle" /><br/>
        文章内容：<textarea name="text" clos="100" rows="5" id="content"></textarea><br/><br/>
            <input type="button" value="发表新文章" onclick="submitform()">
  </body>
</html>